const config = require('../config/config')
const jwt = require('jsonwebtoken')

var loginmodel = {
    login: function (req, res, next) {
        try {
            // console.log(req.body);
            let token = jwt.sign(req.body, config.tokenObject.JWTKey, { expiresIn: config.tokenObject.Exprie })

            res.json({
                code: 200,
                token:   token
            })
        }
        catch (ex) {
            res.dealError(ex);
        }
    }
};

module.exports = loginmodel;